home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Dylan Related / Mindy / Mindy 1.2 - Mac PPC / doc / debug.txt < prev    next >
Encoding:
INI File  |  1995-03-15  |  28.2 KB  |  827 lines  |  [TEXT/MMCC]

  1. [NOTE: This file has been generated by a series of translation tools that
  2.  converted an original FrameMaker .mif file to this .txt file.  The
  3.  conversion tools created the table of contents and uppercased all
  4.  identifiers.  The printed representation of all identifiers in this
  5.  interface is lowercase.  The conversion tools also sometimes drops hyphens
  6.  from identifiers, so if you think a name should have a hyphen in it, it
  7.  probably does.  It is not worth the effort to manually fix this .txt file
  8.  to correct these problems.]
  9.  
  10.  
  11.                               THE MINDY DEBUGGER
  12.                               ==================
  13.  
  14. ------------------------------------------------------------------------------
  15.  
  16. Table of Contents
  17. -----------------
  18.  
  19. 1.   INTRODUCTION
  20.  
  21. 2.  Stack Manipulation Commands
  22.  
  23. 3.  Examining Variables
  24.  
  25. 4.  Libraries and Modules
  26.  
  27. 5.  Evaluating Expressions
  28.  
  29. 6.  Debugger Variables
  30.  
  31. 7.  Restarts and Returning
  32.  
  33. 8.  Interrupting and Single Stepping
  34.  
  35. 9.  Breakpoints
  36.  
  37. 10.  Threads
  38.  
  39. 11.  Miscellaneous Commands
  40.  
  41. 12.  Copyright and Terms Of Use
  42.  
  43. ------------------------------------------------------------------------------
  44.  
  45.     Copyright (c) 1994  Carnegie Mellon University All rights reserved.
  46.     Refer to the end of this document for precise terms of use.
  47.  
  48. 1.   INTRODUCTION
  49. -----------------
  50. When something goes wrong with your program, Mindy drops into the debugger.
  51. From the debugger, you can examine the stack, print out variables, evaluate
  52. expressions, and do various other things that can be helpful in figuring out
  53. what went wrong.
  54.  
  55. For example, if you did not define a method for main, after starting Mindy
  56. you would see something like the following:
  57.  
  58.     No applicable methods for main with arguments #[]
  59.  
  60.     thread [0] D   main
  61.     fp 0x10034090: invoke-debugger({<simple-error> 0x1023fa91})
  62.     mindy> 
  63.  
  64. The first line is the error message.  The second line tells you about the
  65. thread that encountered the error.  For more information about threads see
  66. Section Threads.  The third line tells you about the current stack frame for
  67. the thread; in this example, the last function called, which is at the top
  68. of the stack, is the invoke-debugger function.  It was called with one
  69. argument, a <simple-error>.
  70.  
  71. The following sections discuss the various commands provided by the
  72. debugger.  As a general rule, you can invoke a command by typing at least a
  73. unique prefix of its name.  There are three commonly used commands for which
  74. a single letter suffices, regardless of all other command names:
  75.  
  76.   * (d)own
  77.   * (l)ocals
  78.   * (c)ontinue
  79.  
  80. Throughout this document, some examples build on previous examples, even
  81. when those previous examples come from previous sections of the document. If
  82. there is a reference to the "previous example", then please look
  83. to the previous section's text.
  84.  
  85. This documentation uses the term built-in for definitions created in C code,
  86. within Mindy's implementation.  Opposed to built-in definitions are
  87. definitions written in Dylan code.  Parts of Mindy are built-in and parts
  88. are defined in Dylan code.  Of course, all user code is written in Dylan.
  89. Some debugger commands behave differently depending on whether the object
  90. being manipulated was defined in Dylan code or built-in.
  91.  
  92. 2.  Stack Manipulation Commands
  93. -------------------------------
  94. The Mindy debugger offers a few commands for moving up and down the stack.
  95. The two most common commands are up and down.  Mindy considers the most
  96. recently called function to be at the top of the stack and the least
  97. recently called function to be at the bottom of the stack.  Hence, moving
  98. down the stack moves you from a callee to its caller.  For example, if you
  99. were to type down after the previous example, you would see something like
  100. the following:
  101.  
  102.     mindy> down
  103.     fp 0x10034078: error({<simple-error> 0x1023fa91}, #[], #())
  104.     /afs/cs.cmu.edu/project/gwydion/mindy/src/runtime/cond.dylan
  105.     132     signal(cond);
  106.     mindy> 
  107.  
  108. The first line tells you about the new current frame, which is a call to the
  109. error function.  For a function written in Dylan, as opposed to a built-in
  110. function, the debugger tries to show the line of source code associated with
  111. the current frame.  If the debugger could not find the source file, it still
  112. prints the line number from the source file.
  113.  
  114. While moving down the stack, you might have expected to see a call to the
  115. signal function before seeing a call to the error function.  This does not
  116. happen because signal tail calls invoke-debugger.  When a function tail
  117. calls another function, the callee reuses the current stack frame of the
  118. caller.
  119.  
  120. In addition to the up and down commands, you can move to a specified stack
  121. frame using the frame command.  The debugger numbers stack frames starting
  122. at zero at the top of the stack.  Currently, the debugger does not print
  123. frame numbers when it prints frame information, so moving with the frame
  124. command is only useful as a rough thumb bar.  The following is an example of
  125. using this command to go to the top of the stack:
  126.  
  127.     mindy> frame 0
  128.     fp 0x10034090: invoke-debugger({<simple-error> 0x1023fa91})
  129.     mindy> 
  130.  
  131. If you use the frame command without supplying a frame number, the command
  132. prints the current frame's information.  This is useful if the description
  133. of the current frame has scrolled off the screen, and you want to see it
  134. again.
  135.  
  136. You can view the entire stack by using the backtrace command.  The current
  137. frame stays the same, but the backtrace command always shows the entire
  138. stack from the top to the bottom.  The following is example output from this
  139. command:
  140.  
  141.     mindy> backtrace
  142.     fp 0x10034090: invoke-debugger({<simple-error> 0x1023fa91})
  143.     fp 0x10034078: error({<simple-error> 0x1023fa91}, #[], #()) \
  144.     [/afs/cs.cmu.edu/project/gwydion/mindy/src/runtime/cond.dylan, line 132]
  145.     fp 0x10034058: main()
  146.     mindy> 
  147.  
  148. 3.  Examining Variables
  149. -----------------------
  150. The locals command prints the value for every local variable in the function
  151. associated with the current frame.  If you were at the frame for the error
  152. call in the previous example, using the locals command would look like the
  153. following:
  154.  
  155.     mindy> locals
  156.     noise: #[]
  157.     cond: {<simple-error> 0x1023fa91}
  158.     mindy> 
  159.  
  160. You can use the print command to print a specific local variable.  The
  161. following is an example of printing the cond variable shown in the previous
  162. sample output:
  163.  
  164.     mindy> print cond
  165.     $0={<simple-error> 0x1023fa91}
  166.     mindy> 
  167.  
  168. The print command can also print the value of global variables:
  169.  
  170.     mindy> print size
  171.     $1={<generic-function> size}
  172.     mindy> 
  173.  
  174. For information on the labels the debugger assigns to values (that is, the
  175. $N identifications), see Section Debugger Variables.
  176.  
  177. If the debugger does not find a local variable with the name you supplied,
  178. the debugger looks for a global variable by that name in the current library
  179. and module.  For more information about libraries and modules, see Section
  180. Libraries and Modules.  For more information about the print command, see
  181. Section Evaluating Expressions.
  182.  
  183. 4.  Libraries and Modules
  184. -------------------------
  185. When evaluating expressions, the debugger uses the current library and
  186. current module.  When the debugger starts up, it guesses at what library and
  187. module to make current.  If you want to access a global variable from
  188. another module or library, you first make another module or library be the
  189. current one with the library or module command.  If you invoke the library
  190. command without an argument, it lists the available libraries and tells you
  191. which one is the current one.  If you invoke the library command with an
  192. argument, the debugger makes that library be the current library. In the
  193. same way, the module command either lists the modules of the current
  194. library, or it selects another module be the current module.  The following
  195. are examples of using the library command:
  196.  
  197.     mindy> library
  198.     Dylan-User
  199.     Dylan
  200.  
  201.     Current library is Dylan
  202.     mindy> library dylan-user
  203.     mindy> 
  204.  
  205. The following is an example of using the module command after having just
  206. switched to the Dylan-user library:
  207.  
  208.     mindy> module
  209.        Dylan-User
  210.      i File-Descriptors
  211.      i Threads
  212.      i Extensions
  213.      i System
  214.      i Dylan
  215.  
  216.     The current module is Dylan-User
  217.     mindy> 
  218.  
  219. The i in the second column indicates that those modules are being imported
  220. into the Dylan-user library as opposed to being defined there.  The module
  221. command also indicates which modules are exported from the current library.
  222. For example, if you were to switch to the Dylan library, the module command
  223. would produce the following output:
  224.  
  225.     mindy> library dylan
  226.     mindy> module
  227.        Dylan-User
  228.      x  File-Descriptors
  229.      x  Threads
  230.         Builtin-Stuff
  231.      x  Extensions
  232.      x  System
  233.      x  Dylan
  234.  
  235.     The current module is Dylan-User
  236.     mindy> 
  237.  
  238. The x in the first column indicates that those modules are exported. There
  239. were no xs in the listing of modules in the Dylan-user library because no
  240. modules are exported from the Dylan-user library.  There were no is in the
  241. listing of modules for the Dylan library because the Dylan library does not
  242. import any modules.
  243.  
  244. Whenever you change libraries with the library command, the debugger resets
  245. the current module to the Dylan-user module.  This is because the debugger
  246. needs to make a module current in the new library, and every library has a
  247. Dylan-user module.
  248.  
  249. 5.  Evaluating Expressions
  250. --------------------------
  251. The print command can evaluate simple expressions and print their results.
  252. The following is an example:
  253.  
  254.     mindy> print list(1, 2, 3)
  255.     $2=#(1, 2, 3)
  256.     mindy> print vector(4, 5, 6)
  257.     $3=#[4, 5, 6]
  258.     mindy>
  259.  
  260. The print command evaluates the variable list and then invokes that function
  261. with the arguments 1, 2, and 3.  The debugger labels values printed with a
  262. dollar sign and a number, and you can use these labels in later expressions.
  263. For more information on these, see Section Debugger Variables.
  264.  
  265. The expressions that the debugger accepts are limited.  An expression can be
  266. one of the following:
  267.  
  268.   * One of the following literals:
  269.  
  270.       * decimal number (47)
  271.       * keyword (foo:)
  272.       * string ("foo")
  273.       * #t
  274.       * #f
  275.  
  276.   * A variable name.
  277.   * A debugger variable (for example, $5).
  278.   * A function call (for example, foo(a, b) and bar(c, quux: 3))
  279.   * The address, in hexidecimal (C format, not Dylan), of a valid dylan
  280.     object (for example, 0x102050b1).  Note: use this feature with care, as
  281.     a mistyped address can cause Mindy to dump core.
  282.  
  283. If the expression results in multiple values, all the values are printed on
  284. a single line:
  285.  
  286.     mindy> print values(1, 2, 3)
  287.     $4=1, $5=2, $6=3
  288.  
  289. If an error occurs while the debugger is evaluating the expression, it
  290. prints the error message, aborts the print command, and returns to the
  291. debugger prompt.  The following is an example of this situation:
  292.  
  293.     mindy> print error("oops")
  294.     invocation failed:
  295.       oops
  296.     mindy> 
  297.  
  298. The call command is like the print command, but the call command does not
  299. handle errors by aborting.  When you use the call command, and the
  300. expression causes an error, the debugger returns to its prompt, but any
  301. stack frames that were created due to the call command are now visible for
  302. inspection.  The following is an example of using the call command:
  303.  
  304.     mindy> call error("oops")
  305.  
  306.     oops
  307.  
  308.     thread [0] D   main
  309.     fp 0x100341f4: invoke-debugger({<simple-error> 0x102456b1})
  310.     mindy> 
  311.  
  312. The print and call commands can also evaluate multiple, comma-separated
  313. expressions:
  314.  
  315.     mindy> print 1, 2, 3
  316.     $7=1
  317.     $8=2
  318.     $9=3
  319.     mindy> 
  320.  
  321. 6.  Debugger Variables
  322. ----------------------
  323. The print or call commands label every value printed, and these labels
  324. identify debugger variables.  You can use these identifers in later
  325. expressions to refer to previously computed values.  The following is an
  326. example:
  327.  
  328.     mindy> p list(1, 2, 3)
  329.     $4=#(1, 2, 3)
  330.     mindy> p second($4)
  331.     $5=2
  332.     mindy> 
  333.  
  334. The notation $-N provides a dynamic alternative to identifying debugger
  335. variables.  This notation refers to previously printed values by using N as
  336. a count from the most recently printed value to the least recently printed.
  337. The counting begins at one.
  338.  
  339.     mindy> print a:, b:, c:, d:
  340.     $12=a
  341.     $13=b
  342.     $14=c
  343.     $15=d
  344.     mindy> print $-1, $-2, $-3, $-4
  345.     $16=d
  346.     $17=c
  347.     $18=b
  348.     $19=a
  349.     mindy> 
  350.  
  351. You can use $ as a shorthand for $-1, and $$ for $-2:
  352.  
  353.     mindy> p 2
  354.     $20=2
  355.     mindy> p list($, 4)
  356.     $21=#(2, 4)
  357.     mindy> p list($$, 6)
  358.     $22=#(2, 6)
  359.     mindy> 
  360.  
  361. Mindy keeps references to all debugger variables to prevent them from being
  362. garbage collected.  If you no longer care about previously printed values,
  363. you might want to use the flush command to get rid of them:
  364.  
  365.     mindy> flush
  366.     Flushed all debugger variables.
  367.     mindy> p $0
  368.     invocation failed:
  369.     No debug variable $0
  370.     mindy> p list(a:, b:, c:)
  371.     $0=#(a, b, c)
  372.     mindy> 
  373.  
  374. You can use $aN notation to refer to the arguments passed to the function
  375. call associated with the current stack frame.  N is the argument number,
  376. counting from zero.  The following is an example:
  377.  
  378.     mindy> frame
  379.     fp 0x10034078: error({<simple-error> 0x1023fa91}, #[], #())
  380.     /afs/cs.cmu.edu/project/gwydion/mindy/src/runtime/cond.dylan
  381.     132     signal(cond);
  382.     mindy> p $a0
  383.     $1={<simple-error> 0x1023fa91}
  384.     mindy> p $a1
  385.     $2=#[]
  386.     mindy> p $a2
  387.     $3=#()
  388.     mindy> 
  389.  
  390. The $aN notation does not identify a debugger variable, and the debugger
  391. does not have to create storage for these values because they are already
  392. stored on the call stack.  The flush command has no effect on argument
  393. values.
  394.  
  395. 7.  Restarts and Returning
  396. --------------------------
  397. This section discusses invoking Dylan restart handlers and returning values
  398. for conditions whose recovery protocols allow returning.  If you do not know
  399. what these are, see the Dylan Interim Reference Manual.
  400.  
  401. The debugger has commands that allow you to try to continue executing your
  402. program.  The most common way to continue execution is to invoke a Dylan
  403. restart.  To either list the available restarts or invoke a restart, you use
  404. the restart command:
  405.  
  406.     mindy> call cerror("go on", "oops")
  407.  
  408.     oops
  409.  
  410.     thread [0] D   main
  411.     fp 0x1003428c: invoke-debugger({<simple-error> 0x10245361})
  412.     mindy> restart
  413.     0 [{class <simple-restart>}]: go on
  414.     1 [{class <abort>}]: Blow off call
  415.     mindy> restart 0
  416.     $0=#f
  417.     fp 0x10034090: invoke-debugger({<simple-error> 0x1023fa91})
  418.     mindy> 
  419.  
  420. In this example, the restart command lists two restarts.  The cerror
  421. function establishes the "go on" restart (numbered 0).  The call command
  422. establishes the "Blow off call" restart (numberd 1).  The restart 0 command
  423. caused cerror to return #f, which the call command printed.
  424.  
  425. The abort command invokes the first restart that handles <abort> restarts.
  426. The following is an example of this command:
  427.  
  428.     mindy> call error("oops")
  429.  
  430.     oops
  431.  
  432.     thread [0] D   main
  433.     fp 0x100341fc: invoke-debugger({<simple-error> 0x10241d49})
  434.     mindy> abort
  435.     fp 0x10034090: invoke-debugger({<simple-error> 0x1023fa91})
  436.     mindy> 
  437.  
  438. If Mindy entered the debugger due to a condition that allows returning as
  439. part of its recovery protocol, then you can use the return command.  For
  440. example, consider an <ignorable-error> condition that is a subclass of
  441. <error> and that allows returning as part of its recovery protocol.  The
  442. following example shows returning from the signalling of this condition:
  443.  
  444.     mindy> call signal(make(<ignorable-error>))
  445.  
  446.     {<ignorable-error> 0x10247759}
  447.  
  448.     thread [0] D   main
  449.     fp 0x100341d4: invoke-debugger({<ignorable-error> 0x10247759})
  450.     mindy> restart
  451.     0 [{class <abort>}]: Blow off call
  452.  
  453.     Returning is allowed:
  454.       ignore it.
  455.     mindy> return
  456.     $0=#f
  457.     fp 0x10034090: invoke-debugger({<simple-error> 0x10244831})
  458.     mindy> 
  459.  
  460. 8.  Interrupting and Single Stepping
  461. ------------------------------------
  462. Sometimes it is useful to interrupt your program to see where it is
  463. currently executing.  Consider the following program as an example:
  464.  
  465.     module: Dylan-User
  466.  
  467.     define method main (#rest noise)
  468.       foo(#t);
  469.     end;
  470.  
  471.     define method foo (x)
  472.       if (x)
  473.         foo(#f);
  474.       else
  475.         foo(#t);
  476.       end;
  477.     end;
  478.  
  479. If you were to run this program and then interrupt it, you would see output
  480. similar to the following:
  481.  
  482.     ^C
  483.     Interrupted
  484.     thread [0] R   main
  485.     fp 0x10034060: foo(#f, #())
  486.     foo.dylan
  487.     8       if (x)
  488.     mindy> 
  489.  
  490. After interrupting the program you have the full debugger at your disposal,
  491. as if an error had occurred.  Additionally, you can use the continue command
  492. to resume execution:
  493.  
  494.     mindy> continue
  495.  
  496. You can also use the step command to advance line by line through your
  497. program.  When stepping, if the debugger encounters a function call, it
  498. descends into that function and steps line by line.  The following is an
  499. example:
  500.  
  501.     ^C
  502.     Interrupted
  503.     thread [0] R   main
  504.     fp 0x10034060: foo(#f, #())
  505.     foo.dylan
  506.     8       if (x)
  507.     mindy> step
  508.     foo.dylan
  509.     11      foo(#t)
  510.     mindy> step
  511.     foo.dylan
  512.     8       if (x)
  513.     mindy> step
  514.     foo.dylan
  515.     9       foo(#f)
  516.     mindy> step
  517.     foo.dylan
  518.     8       if (x)
  519.     mindy> 
  520.  
  521. 9.  Breakpoints
  522. ---------------
  523. The debugger has a primitive facility for setting breakpoints in methods
  524. written in Dylan, as opposed to built-in methods.  The breakpoint command
  525. takes two arguments, a reference to a method in which to install the
  526. breakpoint, and the line number at which to install the breakpoint.  For
  527. example, consider the following program:
  528.  
  529.     module: dylan-user
  530.  
  531.     define constant foo =
  532.       method ()
  533.         puts("this is a test\n");
  534.         puts("of breakpoints.\n");
  535.         #f;
  536.       end;
  537.  
  538. If you were to put a breakpoint at line 6 (the second puts), Mindy would
  539. produce output similar to the following:
  540.  
  541.     mindy> break foo, 6
  542.     breakpoint 1 installed in {anonymous <byte-method> 0x10243d31\
  543.     #()} at line 6 (pc 47)
  544.     mindy> call foo()
  545.     this is a test
  546.     Breakpoint
  547.     thread [0] R   main
  548.     fp 0x100341dc: {anonymous <byte-method> 0x10243d31 #()}(#())
  549.     foo.dylan
  550.     6       puts("of breakpoints.\n");
  551.     mindy> 
  552.  
  553. The continue and step commands can be used to continue execution (see
  554. Section Interrupting and Single Stepping):
  555.  
  556.     mindy> step
  557.     of breakpoints.
  558.     foo.dylan
  559.     7       #f;
  560.     mindy> c
  561.     $0=#f
  562.     fp 0x10034090: invoke-debugger({<simple-error> 0x10243e49})
  563.     mindy> 
  564.  
  565. The breakpoint command evaluates its first argument, so you can use an
  566. arbitrary expression for the function.  For example, you could use
  567. find-method to extract a specific method from a generic function and insert
  568. a breakpoint in that method:
  569.  
  570.     mindy> br find-method(size, list(<table>)), 886
  571.     breakpoint 1 installed in {<byte-method> size #({class <table>})}\
  572.     at line 886 (pc 35)
  573.     mindy>
  574.  
  575. The breakpoint command with no arguments lists the currently installed
  576. breakpoints:
  577.  
  578.     mindy> breakpoint
  579.     id  where
  580.      1  pc 47 in {<component> 0x10204ea9}
  581.     mindy> 
  582.  
  583. The delete N command removes a breakpoint, where N is the breakpoint ID
  584. reported in the breakpoint listing.
  585.  
  586. Sometimes the Mindy compiler has to split a single top level form into
  587. multiple methods.  When this happens, the debugger cannot always figure out
  588. where to insert your breakpoint.  Consider the following program:
  589.  
  590.     module: dylan-user
  591.  
  592.     define constant foo =
  593.       method ()
  594.         block (exit)
  595.           puts("this is a test\n");
  596.           puts("of breakpoints.\n");
  597.           #f;
  598.         end;
  599.       end;
  600.  
  601. When this program is compiled, the compiler has to put the contents of the
  602. block in a seperate method.  Because of this, if you were to try to insert a
  603. breakpoint at line 7 it would not work:
  604.  
  605.     mindy> break foo, 7
  606.     {anonymous <byte-method> 0x10243f59 #()} does not span line n\
  607.     umber 7 
  608.     mindy>
  609.  
  610. To insert a breakpoint into this method, you need to use the disassemble
  611. command.  It disassembles a method and all Mindy-generated methods that
  612. might be associated with that method.  For example:
  613.  
  614.     mindy> disassemble foo
  615.     anonymous component, from "foo.dylan"
  616.     5           block (exit)
  617.         47: b0              push    function catch
  618.         48: 21              push    const(1)        {<method-info> 0x10205149}
  619.         49: b2              push    function list
  620.         50: a3              push    value <object>
  621.         51: 91              call    nargs = 1, for single
  622.         52: 0e              push    #()
  623.         53: 10              push    #t
  624.         54: 06              make-method
  625.         55: 71              call    nargs = 1, tail
  626.     {<method-info> 0x10205149}, anonymous component, from "foo.dylan"
  627.     5           block (exit)
  628.         51: 31              push    arg(1)
  629.         52: 20              push    const(0)        {<method-info> 0x102050b1}
  630.         53: b1              push    function list
  631.         54: 90              call    nargs = 0, for single
  632.         55: 0e              push    #()
  633.         56: 10              push    #t
  634.         57: 06              make-method
  635.         58: 60              pop     local(0)
  636.     6             puts("this is a test\n");
  637.         59: b2              push    function puts
  638.         60: 23              push    const(3)        "this is a test\n"
  639.         61: 81 00           call    nargs = 1, for 0
  640.     7             puts("of breakpoints.\n");
  641.         63: b2              push    function puts
  642.         64: 24              push    const(4)        "of breakpoints.\n"
  643.         65: 81 00           call    nargs = 1, for 0
  644.     8             #f;
  645.         67: 11              push    #f
  646.         68: 02              return single
  647.  
  648.     {<method-info> 0x102050b1}, exit component, from "foo.dylan"
  649.     5           block (exit)
  650.         39: b0              push    function apply
  651.         40: a1              push    value throw
  652.         41: 30              push    arg(0)
  653.         42: 32              push    arg(2)
  654.         43: 73              call    nargs = 3, tail
  655.         mindy> 
  656.  
  657. As you can see, the function foo has been split into three methods.  The
  658. first one corresponds to the part of foo that is outside the block.  The
  659. second method corresponds to the code inside the block.  And the third one
  660. corresponds to the exit function established by the block.  Look for the
  661. second method which spans line 7.  The following shows how to install the
  662. breakpoint:
  663.  
  664.     mindy> br 0x10205149, 7
  665.     breakpoint 1 installed in {<method-info> 0x10205149} at line 7 (pc 63)
  666.     mindy> call foo()
  667.     this is a test
  668.     Breakpoint
  669.     thread [0] R   main
  670.     fp 0x100341f8: {anonymous <byte-method> 0x10245f41 #({class <object>})}\
  671.     ({<catch> 0x10245f81}, #())
  672.     foo.dylan
  673.     7       puts("of breakpoints.\n");
  674.     mindy> c
  675.     of breakpoints.
  676.     $0=#f
  677.     fp 0x10034090: invoke-debugger({<simple-error> 0x10244071})
  678.     mindy> 
  679.  
  680. 10.  Threads
  681. ------------
  682. Normally, there is only one thread of execution, in which case you won't
  683. need any of the commands in this section.  When you debug a multi-threaded
  684. program, these commands become very useful.  The thread command either lists
  685. the available threads or switches between them, depending on how you invoke
  686. it.  For example:
  687.  
  688.     mindy> p spawn-thread(foo:, curry(break, "Thread foo"))
  689.     $0={<thread> 0x10243f49}
  690.     mindy> p spawn-thread(bar:, curry(break, "Thread bar"))
  691.     $1={<thread> 0x10246f19}
  692.     mindy> thread
  693.     c [0] D   main
  694.       [1] R   foo
  695.       [2] R   bar
  696.     mindy> 
  697.  
  698. In this example, the thread command lists three threads: the main (or
  699. original) thread and the two threads you just created.  The c in the first
  700. column indicates which thread the debugger is currently examining.  The [N]
  701. indicates the thread ID for each thread.  The D and R designations indicate
  702. the status of each thread.  The main, foo, and bar labels are the
  703. debug-names passed as the first argument to spawn-thread.
  704.  
  705. The different thread status codes are as follows:
  706.  
  707.     STATUS     MEANING
  708.        D       current thread the debugger is examining
  709.        R       running/runable
  710.        S       suspended
  711.        B       blocked on a lock
  712.        W       waiting for an event
  713.  
  714. Giving the thread command an argument causes the debugger to examine another
  715. thread.  You can designate threads with either its numeric ID or the
  716. debug-name passed to spawn-thread:
  717.  
  718.     mindy> thread foo
  719.     thread [1] R   foo
  720.     fp 0x102550bc: {anonymous <byte-method> 0x102443d9 #({class <\
  721.     object>})}({<catch> 0x10244421}, #(), {<value-cell> 0x1024436\
  722.     9}, {<breakpoint> 0x102441e1})
  723.     /afs/cs.cmu.edu/project/gwydion/mindy/src/runtime/cond.dylan
  724.     212     init-arguments: list(format-string: "Continue from break"))
  725.     mindy> thread 0
  726.     thread [0] D   main
  727.     fp 0x10034090: invoke-debugger({<simple-error> 0x1023fa91})
  728.     mindy> 
  729.  
  730. Sometimes it is useful to temporarily disable some threads while debugging
  731. other threads.  The disable <thread-id-or-name> command disables (suspends)
  732. the indicated thread, and the enable command allows a thread to run again:
  733.  
  734.     mindy> disable foo
  735.     [1] S 1 foo
  736.     mindy> enable foo
  737.     [1] R   foo
  738.     mindy>
  739.  
  740. In this example, The status of the foo thread changes from R (runnable) to S
  741. (suspended) when it is disabled.
  742.  
  743. If you repeatedly use the disable command on the same thread, then the
  744. enable command must be used the same number of times to before the thread's
  745. status changes to R. The 1 after the S above is the number of times the
  746. thread foo has been disabled.
  747.  
  748. When a thread is suspended, the continue and step commands do not advance
  749. the thread's execution.  The disable and enable commands can help you find
  750. thread synchronization problems by allowing you to explicitly control when
  751. each thread runs.
  752.  
  753. Invoking the disable or enable command with no argument affects the current
  754. thread the debugger is examining.
  755.  
  756. The kill <thread-id-or-name> command kills the indicated thread.
  757.  
  758. 11.  Miscellaneous Commands
  759. ---------------------------
  760. The help command prints a one line summary of all the debugger commands.
  761.  
  762. The quit command causes Mindy to exit without executing any of the on-exit
  763. hooks.  If you want the on-exit hooks to run, you should invoke the exit
  764. function with the print command:
  765.  
  766.     mindy> print exit()
  767.  
  768. The tron command turns on an internal trace facility that prints the
  769. arguments and results for every function call.  The troff command turns this
  770. off.
  771.  
  772. The error command repeats the error message for the condition that caused
  773. this thread to drop into the debugger.
  774.  
  775. The gc command invokes the garbage collector.
  776.  
  777. The describe command takes an expression as an argument and evaluates it. If
  778. the result is an instance of a class defined in Dylan, as opposed to a
  779. built-in class, then the debugger identifies the class, prints the slot
  780. names, and prints the slot values.  If the result of the expression is an
  781. instance of a built-in class, then the debugger prints the value and its
  782. class.  The describe command does not create or assign to debugger
  783. variables, but you can use debugger variables in the expression given to the
  784. command.  The following examples show the describe command:
  785.  
  786.     mindy> describe make
  787.     {<generic-function> make} is an instance of {class <generic-function>}
  788.  
  789.     mindy> describe "Testing"
  790.     "Testing" is an instance of {class <byte-string>}
  791.  
  792.     mindy> describe make(<table>)
  793.     {<object-table> 0x10245d79} is an instance of {class <object-table>}
  794.     and has the following slots:
  795.     merged-hash-state-slot: {permanent hash state}
  796.     shrink-to-slot: 100
  797.     shrink-when-slot: 10
  798.     expand-to-slot: 300
  799.     expand-when-slot: 200
  800.     bucket-states-slot: #[{permanent hash state}, {permanent hash state}, \
  801.     {permanent hash state}, {permanent hash state}, {permanent hash state}]
  802.     bucket-count-slot: 5
  803.     bucket-array-slot: #[#(), #(), #(), #(), #()]
  804.     item-count-slot: 0
  805.  
  806. 12.  Copyright and Terms Of Use
  807. -------------------------------
  808. Copyright (c) 1994  Carnegie Mellon University All rights reserved.
  809.  
  810. Use and copying of this software and preparation of derivative works based
  811. on this software are permitted, including commercial use, provided that the
  812. following conditions are observed:
  813.  
  814.   * This copyright notice must be retained in full on any copies and on
  815.     appropriate parts of any derivative works.
  816.   * Documentation (paper or online) accompanying any system that
  817.     incorporates this software, or any part of it, must acknowledge the
  818.     contribution of the Gwydion Project at Carnegie Mellon University.
  819.  
  820. This software is made available as is.  Neither the authors nor Carnegie
  821. Mellon University make any warranty about the software, its performance, or
  822. its conformity to any specification.
  823.  
  824. Bug reports, questions, comments, and suggestions should be sent by E-mail
  825. to the Internet address gwydionbugs@cs.cmu.edu.
  826.  
  827.